<template>
  <div>
    <el-dialog
      title="题目审核"
      :visible.sync="isShow"
      width="30%"
      @close="closeEvent"
    >
      <el-form ref="form" :model="form" :rules="rules">
        <el-form-item prop="radio">
          <template>
            <el-radio v-model="form.chkState" label="1">通过</el-radio>
            <el-radio v-model="form.chkState" label="2">拒绝</el-radio>
          </template>
        </el-form-item>
        <el-form-item prop="chkRemarks">
          <el-input
            style="margin-top: 10px"
            type="textarea"
            :rows="2"
            placeholder="请输入审核意见"
            v-model="form.chkRemarks"
          >
          </el-input>
        </el-form-item>
      </el-form>
      <template #footer class="dialog-footer">
        <div style="text-align: right">
          <el-button @click="isShow = false" size="mini">取 消</el-button>
          <el-button type="primary" @click="submit" size="mini"
            >确 定</el-button
          >
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions.js'
export default {
  name: 'Audit',
  props: ['auditData'],
  data () {
    return {
      isShow: false,
      radio: '1',
      form: {
        chkState: '',
        chkRemarks: ''
      },
      rules: {
        chkRemarks: [
          { required: true, message: '请输审核意见', trigger: 'change' },
          {
            min: 6,
            max: 12,
            message: '长度在 6到 12 个字符',
            trigger: 'change'
          }
        ]
      }
    }
  },
  created () {},
  computed: {},
  methods: {
    closeEvent () {
      this.isShow = false
    },
    async submit () {
      // console.log(this.form.chkState)
      await choiceCheck({
        id: this.auditData.id,
        chkState: this.form.chkState - 0,
        chkRemarks: this.form.chkRemarks
      })
      this.$message.success('修改成功！')
      this.closeEvent()
      this.$emit('getData')
    }
  }
}
</script>
<style lang="scss" scoped></style>
